package client.screen;

import javax.microedition.lcdui.*;

import client.MorcMIDlet;


public class ScraptextScreen extends TextBox implements CommandListener {
	private Command back, send;
	private MorcMIDlet midlet;
	
	public ScraptextScreen(MorcMIDlet midlet, String title) {
		super("Enviar scrap", "", 255, TextField.ANY);
		
		this.midlet = midlet;
		
		this.addCommands();
		this.setCommandListener(this);
	}

	protected void addCommands() {
		back = new Command("Voltar", Command.BACK, 0);
		send = new Command("Enviar", Command.ITEM, 1);
		
		this.addCommand(back);
		this.addCommand(send);
		this.setCommandListener(this);
	}

	public void commandAction(Command c, Displayable d) {
		if (c == back) {
			this.midlet.setScreen(MorcMIDlet.SCREEN_SCRAP);
		}
		else if (c == send) {
			this.midlet.sendScrap(this.getString());
		}
	}
	

}
